package com.ruoyi.testDeal.controller;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.service.IJkSbGkService;
import com.ruoyi.testDeal.domain.testYs.JkSbGk;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 金属非金属水泵工况参数Controller
 *
 * @author ruoyi
 * @date 2024-04-09
 */
@RestController
@RequestMapping("/testDeal/jkSbGkInfo")
public class JkSbGkController extends BaseController
{
    @Autowired
    private IJkSbGkService jkSbGkService;

    /**
     * 查询金属非金属水泵工况参数列表
     */
    @PreAuthorize("@ss.hasPermi('testDeal:jkSbGkInfo:list')")
    @GetMapping("/list")
    public TableDataInfo list(JkSbGk jkSbGk)
    {
        startPage();
        List<JkSbGk> list = jkSbGkService.selectJkSbGkList(jkSbGk);
        return getDataTable(list);
    }

    /**
     * 导出金属非金属水泵工况参数列表
     */
    @PreAuthorize("@ss.hasPermi('testDeal:jkSbGkInfo:export')")
    @Log(title = "金属非金属水泵工况参数", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, JkSbGk jkSbGk)
    {
        List<JkSbGk> list = jkSbGkService.selectJkSbGkList(jkSbGk);
        ExcelUtil<JkSbGk> util = new ExcelUtil<JkSbGk>(JkSbGk.class);
        util.exportExcel(response, list, "金属非金属水泵工况参数数据");
    }

    /**
     * 获取金属非金属水泵工况参数详细信息
     */
    @PreAuthorize("@ss.hasPermi('testDeal:jkSbGkInfo:query')")
    @GetMapping(value = "/{sbGkid}")
    public AjaxResult getInfo(@PathVariable("sbGkid") Long sbGkid)
    {
        return success(jkSbGkService.selectJkSbGkBySbGkid(sbGkid));
    }

    /**
     * 新增金属非金属水泵工况参数
     */
    @PreAuthorize("@ss.hasPermi('testDeal:jkSbGkInfo:add')")
    @Log(title = "金属非金属水泵工况参数", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody JkSbGk jkSbGk)
    {
        return toAjax(jkSbGkService.insertJkSbGk(jkSbGk));
    }

    /**
     * 修改金属非金属水泵工况参数
     */
    @PreAuthorize("@ss.hasPermi('testDeal:jkSbGkInfo:edit')")
    @Log(title = "金属非金属水泵工况参数", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody JkSbGk jkSbGk)
    {
        return toAjax(jkSbGkService.updateJkSbGk(jkSbGk));
    }

    /**
     * 删除金属非金属水泵工况参数
     */
    @PreAuthorize("@ss.hasPermi('testDeal:jkSbGkInfo:remove')")
    @Log(title = "金属非金属水泵工况参数", businessType = BusinessType.DELETE)
    @DeleteMapping("/{sbGkids}")
    public AjaxResult remove(@PathVariable Long[] sbGkids)
    {
        return toAjax(jkSbGkService.deleteJkSbGkBySbGkids(sbGkids));
    }
}
